package easy;

public class Solution_944 {

    public int minDeletionSize(String[] strs) {
        int count = 0;
        int length = strs[0].length();
        for (int i = 0; i < length; i++) {
            boolean del_flag = false;
            char pre = strs[0].charAt(i);
            for (int j = 1; j < strs.length; j++) {
                char c = strs[j].charAt(i);
                if (c < pre) {
                    del_flag = true;
                    break;
                }
                pre = c;
            }
            if (del_flag) {
                count++;
            }
        }
        return count;
    }

    public static void main(String[] args) {
        Solution_944 model = new Solution_944();
        System.out.println(model.minDeletionSize(new String[]{"cba", "daf", "ghi"}));
        System.out.println(model.minDeletionSize(new String[]{"a", "b"}));
        System.out.println(model.minDeletionSize(new String[]{"zyx", "wvu", "tsr"}));
    }
}
